package com.cred.industries.core.util;

import java.util.concurrent.locks.Lock;

public class AutoLock implements AutoCloseable {

	static public AutoLock createLock(Lock lock) {
		
		return new AutoLock(lock);
	}
	
	private Lock mLock;
	
	private AutoLock(Lock lock) {
		mLock = lock;
		mLock.lock();
	}
	
	@Override
	public void close() {

		mLock.unlock();
	}
}
